package com.tosmart.jorm.tools;

import java.sql.Connection;

/**
 * @author tosmart@gmail.com
 * @see ConnectionPool
 */
public class DBHelper {

    private static DBHelper instance;

    private DBHelper() {
        config("proxool-oracle.xml", "test");
    }

    public static DBHelper get() {

        if (instance == null)
            instance = new DBHelper();

        return instance;
    }

    public void config(String xmlFile, String alias) {
        System.out.println("Connection-Pool '" + alias + "' config ...");
        ConnectionPool.config(xmlFile);
        proxoolAlias = alias;
    }

    public Connection getConnection() {
        return ConnectionPool.getConnection(proxoolAlias);
    }

    private String proxoolAlias;
}
